<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <h1>我的微博列表</h1>
    <div v-for="w in arr">
        <h3>{{w.content}}</h3>
        <div>
            发布于:{{w.created}}
            <a href="javascript:void(0)" @click="del(w.id)">删除</a>
        </div>
        <img v-for="url in w.urlArr" :src="url" style="width: 100px;height: 100px" alt="">
    </div>
</div>

<script src="js/vue.min.js"></script>
<script src="js/axios.min.js"></script>
<script>
    let v = new Vue({
        el:"body>div",
        data:{
            arr:[],
        },
        created:function (){
            //查询当前登录用户发布的所有微博
            axios.get("/selectSelf").then(function (response){
                v.arr = response.data
                for(let w of v.arr){
                    w.urlArr = w.urls==""?[]:w.urls.split(",");
                }
            })
        },
        methods:{
            del(id){
                if(confirm("您确认删除此微博吗?")){
                    axios.get("/delete?id="+id).then(function (response){
                        location.reload();
                    })
                }
            }
        }
    })
</script>
</body>
</html>